package 慕课网.model;

public class Student {
    private String studentNO;
    private String studentName;
    private String studentSex;
    private int studentAge;
    private Subject studentSubject;
    public Student(){

    }
    public Student(String studentNO,String studentName,String studentSex,int studentAge,Subject studentSubject){
        this.setStudentNO(studentNO);
        this.setStudentName(studentName);
        this.setStudentSex(studentSex);
        this.setStudentAge(studentAge);
        this.setStudentSubject(studentSubject);
    }
    public Subject getStudentSubject() {
        if(studentSubject==null)
            this.studentSubject=new Subject();
        return studentSubject;
    }
    public void setStudentSubject(Subject studentSubject) {
        this.studentSubject = studentSubject;
    }
    public String getStudentNO() {
        return studentNO;
    }
    public void setStudentNO(String studentNO) {
        this.studentNO = studentNO;
    }
    public String getStudentSex() {
        return studentSex;
    }
    public void setStudentSex(String studentSex) {
        if(studentSex=="女")
        {
            this.studentSex = studentSex;
        }
        else{
            this.studentSex="男";
        }
    }
    public int getStudentAge() {
        return studentAge;
    }
    public void setStudentAge(int studentAge) {
        if(studentAge<10||studentAge>100)
        {
            this.studentAge=18;
        }
        else
        {
            this.studentAge = studentAge;
        }
    }
    public String getStudentName() {
        return studentName;
    }
    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }
    public String introduction(){
        String str="学生信息如下：\n姓名："
                +this.getStudentName()
                +"\n学号："+this.getStudentNO()
                +"\n性别："+this.getStudentSex()
                +"\n年龄："+this.getStudentAge()+"\n所报专业名称："+this.getStudentSubject().getSubjectName()
                +"\n学制年限："+this.getStudentSubject().getSubjectLife();
        return str;
    }
    public String introduction(String subjectName,int subjectLife){
        String str="学生信息如下：\n姓名："
                +this.getStudentName()
                +"\n学号："+this.getStudentNO()
                +"\n性别："+this.getStudentSex()
                +"\n年龄："+this.getStudentAge()
                +"\n所报专业名称："+subjectName
                +"\n学制年限："+subjectLife;
        return str;
    }
    public String introduction(Subject mysubject){
        String str="学生信息如下：\n姓名："
                +this.getStudentName()
                +"\n学号："+this.getStudentNO()
                +"\n性别："+this.getStudentSex()
                +"\n年龄："+this.getStudentAge()
                +"\n所报专业名称："+mysubject.getSubjectName()
                +"\n学制年限："+mysubject.getSubjectLife();
        return str;
    }
}
